package com.bigmi.admin.controller;

import com.bigmi.admin.service.ChannelService;
import com.bigmi.model.admin.dto.ChannelDto;
import com.bigmi.model.common.dtos.ResponseResult;
import com.bigmi.model.wemedia.pojos.WmChannel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/api/v1/channel")
public class ChannelController {

    @Autowired
    private ChannelService channelService;
    @PostMapping("/list")
    public ResponseResult list(@RequestBody ChannelDto channelDto){
        return channelService.listPage(channelDto);
    }

    @PostMapping("/save")
    public ResponseResult save(@RequestBody WmChannel adChannel){
        return channelService.saveChannel(adChannel);
    }
    @GetMapping("/del/{id}")
    public ResponseResult del(@PathVariable Integer id){
        return channelService.del(id);
    }
    @PostMapping("/update")
    public ResponseResult upData(@RequestBody WmChannel wmChannel){
        return channelService.upData(wmChannel);
    }
}
